package sk.hackcraft.util.generator;

import java.util.Random;

public class UniformContinuousRandom implements ContinuousRandom
{
	private final double minValue;
	private final double maxValue;
	
	private final Random random;
	
	public UniformContinuousRandom(double minValue, double maxValue)
	{
		this(SeedGenerator.getNextSeed(), minValue, maxValue);
	}
	
	public UniformContinuousRandom(long seed, double minValue, double maxValue)
	{
		this.random = new Random(seed);
		
		this.minValue = minValue;
		this.maxValue = maxValue;
	}
	
	@Override
	public double next()
	{
		return minValue + random.nextDouble()*(maxValue - minValue);
	}
}
